package com.example.springbootdemo.repository;

import com.example.springbootdemo.entity.UserCase;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author Gong.Yang
 */
@Repository
public interface UserCaseRepository {

    @Select("select * from user_case")
    List<UserCase> selectList();

    @Select("select * from user_case where id = #{id}")
    UserCase selectById(@Param("id") String id);


    @Insert("insert into user_case(id,name,age,email,create_time,update_time) values(#{user.id},#{user.name},#{user.age},#{user.email},#{user.createTime},#{user.updateTime})")
    void insert(@Param("user") UserCase userCase);

    @Update("update user_case set name=#{user.name},age=#{user.age},email=#{user.email},update_time=#{user.updateTime} where id = #{user.id}")
    void updateById(@Param("user") UserCase userCase);

    @Delete("delete from user_case where id = #{id}")
    void deleteById(@Param("id") String id);
}
